#!/bin/sh
clear
#NetworkCardName=$(awk 'BEGIN {max = 0} {if ($2+0 > max+0) {max=$2 ;content=$0} } END {print $1}' /proc/net/dev  | sed 's/[:]*$//g')
NetworkCardName=$(ifconfig | grep 'enp' | awk -F ":" '{print $1}' | sed 's/,/\n\r/g')
IP=$(ip addr | awk '/^[0-9]+: / {}; /inet.*global/ {print gensub(/(.*)\/(.*)/, "\\1", "g", $2)}')
MAC=$(cat /sys/class/net/${NetworkCardName}/address)
Time=$(date "+%Y.%m.%d-%H.%M.%S")
echo ${NetworkCardName}
echo ${MAC}
echo ${IP}
echo ${Time}
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
FilesName=./${Time}-'注册信息.txt'
echo ${FilesName}
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
echo '123qwe' | sudo -S touch ${FilesName}
sudo chmod  777 ${FilesName}
echo ${MAC} >${FilesName} && echo  "\r" >>${FilesName}
sudo kylin_gen_register>>${FilesName} && echo  "\r" >>${FilesName}		#查看注册码
sudo kylin_activation_check>>${FilesName} && echo  "\r\n" >>${FilesName}		#查看激活信息
cat /etc/.kyhwid>>${FilesName} && echo  "\r" >>${FilesName}		#查看激活码
cat /etc/.kyactivation>>${FilesName} && echo  "\r" >>${FilesName}			#查看系统激活码
sudo dmidecode -s system-uuid>>${FilesName} && echo  "\r" >>${FilesName}		#查看机器码

#echo '123qwe' | sudo -S  cat /etc/.kyinfo >>${FilesName}		#查看系统信息
#sudo cat /etc/LICENSE >>${FilesName}		#查看LICENSE
cat ${FilesName}


#激活相关命令：
#查看系统信息：sudo  cat  /etc/.kyinfo
#查看注册码：sudo   kylin_gen_register
#查看激活信息：sudo   kylin_activation_check
#查看系统激活码：cat   /etc/.kyactivation
#查看服务序列号：我的电脑右击属性或者cat   /etc/.kyinfo
#查看LICENSE：cat   /etc/LICENSE
#查看机器码：sudo   dmidecode   -s   system-uuid
#查看绑定的主板/硬盘/网卡：cat  /etc/.kyhwid文件最后一个字母（"S"是主板，"H"是磁盘，"N"是网卡。）
#建议保存注册码和绑定信息记录，方便后续因为硬件问题而重装和激活，便于后续硬件坏了需要重装并激活时，我们能对比找到对应的设备并解绑回收。
#备注：
#已激活的系统ghost后无法激活时可删除/etc/.kyhwid重启重新激活（消耗新的点数）




